package ShiYan;

import java.util.Scanner;
public class Example23 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int []arr = new int[20];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = scanner.nextInt();
        }
        System.out.println("请输入你要查找的数:");
        int m = scanner.nextInt();

        for (int i = 0; i < arr.length-1; i++) {
            for (int j = i; j < arr.length-i-1; j++) {
                if (arr[j] > arr[j+1]){
                    int tmp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = tmp;
                }
            }
        }
        System.out.println("排序后");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }
        System.out.println();
       int i = 0;
        while (i<arr.length){
            if(m != arr[i]){
                i++;
            }else{
                System.out.println("m在数组arr中");
                break;
            }
        }
    }
}
